import React from 'react';
import ReactDOM from 'react-dom/client';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react';
import { store, persistor } from './store';
import App from './App.tsx';
import './index.css';

import { clearReduxPersistStorage } from './utils/clearStorage';

// 在应用启动时初始化默认草稿数据
async function initApp() {
    // 清除所有持久化数据
    clearReduxPersistStorage();

    ReactDOM.createRoot(document.getElementById('root')!).render(
        <Provider store={store}>
            <PersistGate loading={null} persistor={persistor}>
                <App />
            </PersistGate>
        </Provider>
    );
}

initApp();
